:root {
    --db-options-bg-color: var(--black-3);
    --container-focus-bg-color: var(--black-1);
    --input-box-bg-color: var(--black-2);
    --alerting-btn-img: url(../assets/alerting-white-icon.svg);
}

[data-theme='light'] {
    --db-options-bg-color: var(--white-3);
    --container-focus-bg-color: #F6FCFF;
    --input-box-bg-color: var(--white-0);
    --alerting-btn-img: url(../assets/alerting-btn-light.svg);
}

/* TOGGLE SWITCH  */
.switch {
    position: relative;
    display: inline-block;
    width: 24px;
    height: 14px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--db-options-bg-color);
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 10px;
    width: 10px;
    left: 2px;
    bottom: 2px;
    background-color: var(--white-0);
    -webkit-transition: .4s;
    transition: .4s;
}

input:checked+.slider {
    background-color: var(--purple-1);
}

input:checked+.slider:before {
    transform: translateX(10px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

.table-view-toggle-container,
.graph-view-container {
    height: 24px;
    width: fit-content;
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color-regular);
}

.alert-from-metrics-btn {
    background-image: var(--alerting-btn-img);
}

.add-metrics-to-db-btn {
    background-image: var(--dashboard-btn-img);
}

.metrics-query .query-box .options-container,
.formula-box .options-container-formula {
    display: none;
}

/* Metrics Explorer */
#metrics-container {
    padding: 20px;
    height: 100%;
    overflow-y: scroll;
    display: block;
    margin: 0;
}

#metrics-explorer .btn {
    margin-right: 8px;
}

#metrics-explorer .btn .plus-icon {
    font-size: 20px;
    margin-bottom: 4px;
    margin-right: 6px;
}

.metrics-query,
.formula-box {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-top: 8px;
}

.formula-functions-container div {
    position: relative;
    height: 26px;
    display: flex;
    align-items: center;
    padding: 0px 12px;
}

.show-functions-formula {
    border: 1px solid var(--border-btn-color) !important;
}

.selected-function-formula {
    border: 1px solid var(--border-btn-color);
}

.metrics-query {
    width: 100%;
}

.metrics-query .query-box {
    align-items: flex-start;
    width: calc(100% - 195px);
    padding: 0px;
}

.metrics-query .query-box .query-builder {
    flex-wrap: wrap;
    height: auto;
}

.metrics-query input,
.formula-box input {
    color: var(--text-color) !important;
    outline: none;
    border-radius: 0;
    background-color: var(--input-box-bg-color);
}

.formula-box .formula {
    width: 200px;
    border-radius: 0 5px 5px 0;
}

.formula-box .formula:focus {
    border-radius: 0 5px 5px 0;
    background-color: var(--container-focus-bg-color);
    border-color: #2D69BC;
}

.formula-box .formula.error-border,
.all-selected-functions-formula.error div {
    border: 1px solid #EB364B !important;
    border-left: none;
}

.formula-arrow {
    cursor: pointer;
    border-radius: 5px 0px 0px 5px;
    background-color: var(--purple-2);
    color: var(--white);
    height: 26px;
    width: 26px;
    padding: 3px 6px;
}

.metrics-query input:focus,
.formula-box input:focus {
    background: var(--ui-widget-bg-color);
    outline: none;
    border-radius: 0px;
}

.metrics-query div {
    display: flex;
    align-items: center;
}

.metrics-query .query-box div {
    border: 1px solid var(--border-btn-color);
    border-right: none;
    height: 26px;
    display: flex;
    align-items: center;
    padding: 0px 12px;
}

.metrics-query .value-container {
    border-right: 1px solid var(--border-btn-color) !important;
}

.metrics-query div .tag,
.metrics-query div .value {
    color: var(--text-color);
    padding: 2px 28px 2px 6px;
    margin-right: 8px;
    white-space: nowrap;
    position: relative;
}

.metrics-query div .tag {
    background-color: var(--selected-filter-blue);
}

.metrics-query div .value {
    background-color: var(--selected-filter-red);
}

.tag-container,
.value-container {
    min-width: 200px;
    background-color: var(--input-box-bg-color);
}

.everywhere,
.everything {
    height: 24px !important;
    border: none !important;
    border-radius: 0px;
    flex-grow: 1;
    padding: 0 !important;
    background-color: var(--input-box-bg-color) !important;
}

.ui-helper-hidden-accessible {
    display: none !important;
}

.metrics-query .query-name.active {
    padding: 10px;
    border-radius: 5px 0 0 5px;
    background-color: var(--purple-2);
    color: var(--white);
    border: none !important;
    font-weight: bold;
    cursor: pointer;
}

.metrics-query .query-name {
    background-color: var(--input-box-bg-color);
    border-radius: 5px 0 0 5px;
    color: var(--text-color);
    font-weight: bold;
    cursor: pointer;
}

.metrics-query .metrics {
    min-width: 230px;
    width: auto;
    background-color: var(--selected-filter-yellow) !important;
}

.metrics-query .metrics:focus {
    background-color: var(--container-focus-bg-color) !important;
    outline: 1px solid #2D69BC;
}

.metrics-query .agg-function {
    width: 90px !important;
    background-color: var(--drop-down-btn-bg-regular) !important;
    border-radius: 0px !important;
}

.metrics-query .agg-function:focus {
    background-color: var(--drop-down-btn-bg-regular);
}

.metrics-query .remove-query,
.formula-box .remove-query {
    border-radius: 18px;
    height: 16px;
    width: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    padding-bottom: 2.5px;
    cursor: pointer;
    color: #fff;
    background: #656F76;
    font-weight: 600;
}

.metrics-query .remove-query.disabled,
.metrics-query .remove-query.disabled:hover {
    cursor: not-allowed;
    background: #a0a4a6;
    border-radius: 18px;
}

/* Styles for error messages */
.error-message {
    display: block;
    font-weight: 700;
    font-size: 20px;
    color: var(--empty-response-text-color, #808080);
    text-align: center;
    margin: auto;
    padding: 20px;
    width: 90%;
    white-space: pre-wrap;
    line-height: 30px;
}

.show-functions-formula.disabled,
.show-functions-formula.disabled:hover {
    cursor: not-allowed;
}

.metrics-query .remove-query:hover,
.formula-box .remove-query:hover {
    background: #EB364B;
    border-radius: 5px;
}

.metrics-graph-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(calc(50% - 15px), 1fr));
    grid-gap: 20px;
    border: none;
}

.metrics-graph,
#merged-graph-container {
    height: 460px;
    border: 1px solid var(--border-btn-color);
    box-sizing: border-box;
    border-radius: 5px;
    box-shadow: var(--box-shadow);
}

.metrics-graph.full-width {
    grid-column: span 2;
}

.metrics-graph div:first-child,
.merged-graph-name {
    padding: 8px;
    border-bottom: 1px solid var(--border-btn-color);
    font-weight: 600;
    background-color: var(--drop-down-btn-bg-regular);
    border-radius: 5px 5px 0 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#visualization-options div {
    margin-right: 14px;
    font-size: 10px;
    white-space: nowrap;
}

#visualization-options input {
    height: 20px !important;
    color: var(--text-color);
    width: 84px;
    padding: 7px;
    font-size: 10px;
}

.alias-box {
    margin-right: 10px;
}

.raw-query-btn svg{
    width: 15px;
}

.alias-box .as-btn,
.metrics-raw-query,
.raw-query-btn {
    height: 24px;
    width: 28px;
    display: flex;
    justify-content: center;
    border-radius: 5px;
}

.alias-box .as-btn:hover,
.metrics-raw-query:hover,
.raw-query-btn:hover {
    background-color: var(--purple-2);
    color: var(--white);
    cursor: pointer;
}

.alias-filling-box div {
    border: 1px solid var(--border-btn-color);
    height: 26px;
    width: 34px;
    display: flex;
    justify-content: center;
}

.alias-filling-box div:first-child {
    border-radius: 5px 0 0 5px;
    cursor: default;
}

.alias-filling-box div:last-child {
    border-radius: 0 5px 5px 0;
    cursor: pointer;
    font-size: 20px;
    padding-bottom: 2px;
}

.graph-canvas,
.merged-graph {
    position: relative;
    height: calc(400px - 85px);
    padding: 16px;
}

.legend-container {
    overflow: scroll;
    height: 110px;
}

.metrics-query .query-box .tag-container:focus-within,
.everywhere:focus,
.metrics-query .query-box .value-container:focus-within,
.everything:focus {
    background: var(--container-focus-bg-color) !important;
    /* Change background color when input is focused */
}

.metrics-query .query-box .tag-container:focus-within,
.metrics-query .query-box .value-container:focus-within {
    border: 1px solid #2D69BC;
    background: var(--container-focus-bg-color) !important;
}

.metrics-query .tag .close,
.metrics-query .value .close {
    font-size: 18px;
    font-weight: bold;
    position: absolute;
    top: -4px;
    right: 8px;
    cursor: pointer;
}

/* JQUERY AUTOCOMpLETE */
.metrics-ui-widget.ui-widget {
    height: auto !important;
    max-height: 260px;
    overflow: scroll;
}

.metrics-ui-widget.ui-widget.ui-widget-content {
    list-style-type: none;
    border-radius: 0px !important;
    width: fit-content;
    min-width: 233px !important;
}

.ui-autocomplete {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    display: none;
    float: left;
    min-width: 160px;
    padding: 0;
    margin: 2px 0 0;
    list-style: none;
    font-size: 14px;
    text-align: left;
    background-clip: padding-box;
}

.metrics-ui-widget.ui-autocomplete>li>div {
    display: block;
    padding: 3px 20px;
    clear: both;
    font-weight: normal;
    height: 34px !important;
    white-space: nowrap;
    display: flex;
    align-items: center;
}

.metrics-ui-widget .ui-state-hover,
.metrics-ui-widget .ui-state-active,
.metrics-ui-widget .ui-state-focus {
    color: #ffffff;
    text-decoration: none;
    background-color: #2D69BC !important;
    cursor: pointer;
    height: 34px !important;
}

.ui-helper-hidden-accessible {
    border: 0;
    clip: rect(0 0 0 0);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
}

.formula-error-message {
    display: none;
    background-color: #EB364B;
    border-radius: 50%;
    height: 16px;
    width: 16px;
    color: #fff;
    font-weight: bolder;
    justify-content: center;
    position: absolute;
    top: -6px;
    right: -6px;
    border: 1px solid #fff;
}

.show-functions,
.show-functions-formula {
    width: 26px;
    border-right: 1px solid var(--border-btn-color) !important;
    cursor: pointer;
    position: relative;
    border-radius: 0 5px 5px 0;
    background-image: var(--metrics-function-icon);
    background-repeat: no-repeat;
    background-size: 35%;
    background-position: center;
    background-color: var(--drop-down-btn-bg-regular);
}

.functions-container,
.formula-functions-container {
    border: none !important;
    position: relative;
    height: 26px;
    display: flex;
    align-items: center;
    padding: 0px 12px;
}

.functions-container::before,
.formula-functions-container::before {
    left: -7px;
    content: "";
    display: inline-block;
    position: absolute;
    top: 50%;
    margin-top: -2px;
    border-bottom: 3px solid var(--border-btn-color);
    width: 12px;
    margin-left: 7px;

}

.selected-function .close,
.selected-function-formula .close {
    font-size: 22px;
    font-weight: bold;
    cursor: pointer;
    margin-left: 12px;
    margin-bottom: 3px;
}

.position-container,
.all-selected-functions,
.query-builder,
.raw-query,
.all-selected-functions-formula {
    position: relative;
    padding: 0px !important;
    border: none !important;
}

.options-container,
.options-container-formula {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 238px;
    padding: 0 !important;
    border: none !important;
    z-index: 999;
}

.raw-query {
    width: 100%;
    height: auto !important;
    align-items: flex-start !important;
}

#metrics-container .refresh-btn {
    height: 24px !important;
    width: 24px !important;
    border: 1px solid var(--border-color-regular);
    margin-right: 10px;
    border-radius: 5px !important;
}

.panelDisplay .panEdit-panel .merged-graph {
    height: calc(30vh - 65px);
    padding: 0;
}

.raw-query-input {
    width: 100%;
    min-height: 26px;
    resize: none;
    padding: 4px 8px;
    font-family: monospace;
    line-height: 18px;
    border: 1px solid var(--search-input-border);
    box-sizing: border-box;
    overflow: hidden;
    outline: none;
    font-size: 11px;
    background-color: var(--input-box-bg-color);
    color: var(--text-color);
}
